package com.hwod;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

/**
 * 叠积木
 */
public class Hwod3 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String[] input = in.nextLine().split(" ");

        Map<Integer, Integer> counts = new LinkedHashMap<>(); // 记录每一种积木长度的个数，键做自动排序
        for (int i = 0; i < input.length; i++) {
            int len = Integer.parseInt(input[i]);
            counts.put(len, counts.getOrDefault(len, 0) + 1);
        }

        List<Integer> keys = new ArrayList<>(counts.keySet());
        keys.sort(new Comparator<Integer>() {
            @Override
            public int compare(Integer integer, Integer t1) {
                return integer - t1;
            }
        });

        int result = 0;
        int maxLen = keys.get(keys.size() - 1);

        // 先试下以最大长度为底能不能得到最优解
        List<Integer> jumpLength = new ArrayList<>();
        for (int i = 0; i < keys.size(); i++) {
            int currLen = keys.get(i);
            if (jumpLength.contains(currLen)) {
                continue;
            }
            int currCount = counts.get(currLen);
            if (currLen * 2 == maxLen && currCount % 2 == 0) {
                result += currCount / 2;
            } else if (currLen == maxLen) {
                result += currCount;
            } else if (keys.contains(maxLen - currLen) && currCount == counts.get(maxLen - currLen)) {
                jumpLength.add(maxLen - currLen);
                result += currCount;
            } else {
                result = -1;
                break;
            }
        }
        
        // 没有最优解，改变每层长度，继续求解
        if (result == -1) {
            jumpLength.clear();
            List<Integer> jumpItemLen = new ArrayList<>();
            for (int i = 0; i < keys.size(); i++) {
                for (int j = i; j < keys.size(); j++) {
                    int itemLen = keys.get(i) + keys.get(j); // 每层长度
                    if (itemLen > maxLen && !jumpItemLen.contains(itemLen)) { // 两层长度加起来小于等于最大长度的不考虑
                        jumpItemLen.add(itemLen);
                        int tempResult = 0;
                        for (int k = 0; k < keys.size(); k++) {
                            int currLen = keys.get(k);
                            if (jumpLength.contains(currLen)) {
                                continue;
                            }
                            int currCount = counts.get(currLen);
                            if (currLen * 2 == itemLen && currCount % 2 == 0) {
                                tempResult += currCount / 2;
                            } else if (keys.contains(itemLen - currLen) && currCount == counts.get(itemLen - currLen)) {
                                jumpLength.add(itemLen - currLen);
                                tempResult += currCount;
                            } else {
                                tempResult = -1;
                                break;
                            }
                        }

                        result = Math.max(result, tempResult);
                        jumpLength.clear();
                    }
                }
            }
        }
        
        System.out.println(result);
        
    }

}
